<?php
namespace app\wechat\controller;
use think\Controller;
use EasyWeChat\Factory;
use EasyWeChat\Kernel\Messages\Message;
use app\wechat\library\WechatEvent;
class Wechat extends Controller{

    public function account(){
        $config = [
            'app_id' => config('wechat.app_id'),
            'secret' => config('wechat.secret'),
            'token'  => 'lifecloud',
            'aes_key'=> 'RPbOz1RG8xNvOQoRlaL6czXql4eqssH538VG6z95z1w',
            'response_type' => 'array',
        ];

        $app = Factory::officialAccount($config);
        $app->server->push(WechatEvent::class,Message::EVENT);
        $response = $app->server->serve();
        // 将响应输出
        $response->send(); exit;
    }
}
